package com.rst.contacts;


import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class Calendar1 {
	public static void CalendarDemo(int Year, int Month) {
		GregorianCalendar a = new GregorianCalendar();
		a.set(Calendar.YEAR, Year);
		a.set(Calendar.MONTH, (Month - 1));
		a.set(Calendar.DAY_OF_MONTH, 1);
		

		int daysInMonth = a.getActualMaximum(Calendar.DAY_OF_MONTH); // 28
		String str = "<td class='head-td-name'>Name</td>";
		for(int i = 1;i<=daysInMonth;i++){
			a.set(Calendar.DAY_OF_MONTH, i);
			SimpleDateFormat formatter = new SimpleDateFormat("E");
			str = str + "<td class='head-td-date'><div class='day'>"+formatter.format(a.getTime())+"</div> <div class='date'>"+i+"</div></td>";									
		}
		System.out.println(str);
		int month = a.get(Calendar.MONTH);
		System.out.println(a.get(Calendar.YEAR));
		System.out.println(month);
	}
	
	public static void main(String[] args) {
		CalendarDemo(2014,3);
		//doSimpleDateFormat();
	}
}